﻿<?php


$obj=new mysql($config);

$id=empty($_GET['id'])?0:$_GET['id'];
$sql="select * from cate where pid=$id";
$date=$obj->getCondition($sql);


if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])){
   echo json_encode($date);
   die;
}



if(!empty($_POST)){
    $myfile=$_FILES['myfile'];
    if(!empty($myfile['name'])){

			$rootpath=upload($myfile);
    }

    $_POST['cate_pic']=!empty($rootpath)?$rootpath:'';
    $row=$obj->insert($_POST,'cate');
    if($row){
        echo '<script>alert("添加成功");</script>';
    }else{
        echo '<script>alert("添加失败");</script>';
    }
}









require_once (VIEW_PATH.'admin/layout.html');

